<extend name="Public/base" />

<block name="body">
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>夺宝活动列表</h2>
	</div>
	<div class="cf">
        <!-- 高级搜索 -->
		<div class="search-form cf fr">
			<div class="sleft">
				<input type="text" name="keyword" autocomplete="off" class="search-input" value="{:I('keyword')}" placeholder="请输入活动名称">
				<a class="sch-btn" href="javascript:;" id="search" url="{:U('index')}"><i class="btn-search"></i></a>
			</div>
		</div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
	<table class="">
    <thead>
        <tr>
		<th class="">期数</th>
		<th class="">发起人</th>
		<th class="">标题</th>
		<th class="">开始时间</th>
		<th class="">结束时间</th>
		<th class="">奖品类型</th>
		<th class="">中奖人</th>
		<th class="">添加时间</th>
		<th class="">操作</th>
		</tr>
    </thead>
    <tbody>
		<notempty name="_list">
		<volist name="_list" id="vo">
		<tr>
			<td>第{$vo.id}期</td>
			<td><gt name="vo.uid" value="0">{$vo.uid|get_nickname}<else />(管理员)</gt></td>
			<td>{$vo.title}</td>
			<td>{$vo.start_time|time_format}</td>
			<td>{$vo.end_time|time_format}</td>
			<td>{$prize_type[$vo['prize']]}</td>
			<td>{$vo.lottery_uid|get_nickname}</td>
			<td>{$vo.add_time|time_format}</td>
			<td>
				<a href="{:U('edit', array('id'=>$vo['id']))}">查看</a>
				<a class="confirm ajax-get" href="{:U('delete', array('id'=>$vo['id']))}">删除</a>
			</td>
		</tr>
		</volist>
		<else/>
		<td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
		</notempty>
	</tbody>
    </table>
	</div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
	<script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
	<script type="text/javascript">
	$(function(){
		//搜索功能
		$("#search").click(function(){
			var url = $(this).attr('url');
	        var query  = $('.search-form').find('input').serialize();
	        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
	        query = query.replace(/^&/g,'');
	        if( url.indexOf('?')>0 ){
	            url += '&' + query;
	        }else{
	            url += '?' + query;
	        }
			window.location.href = url;
		});
		
	    //回车自动提交
	    $('.search-form').find('input').keyup(function(event){
	        if(event.keyCode===13){
	            $("#search").click();
	        }
	    });
	    
	    //导航高亮
        highlight_subnav('{:U('index')}');
	})
	</script>
</block>
